const mongoose = require('mongoose');
const goodSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
        comment:'商品名称'
    },
    price: {
        type: String,
        required: true,
        comment:'商品价格'
    },
    describe:{
        type: String,
        required: true,
        comment:'商品描述'
    },
    imageUrls: {
        type: [String],
        required: true,
        comment:'商品图片 默认首图第0张'
    },
    category: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Category',
        comment:'关联外键'
    },
    status:{
        type: String,
        default:'1'
    },
    tags:{
        type: [String],
        default:[],
        comment:'商品标签'
    },
    recommend:{
        type: [String],
        default:[],
        comment:'推荐标签'
    },
    created_at: {
        type: Date,
        default: Date.now,
    },
    updated_at: {
        type: Date,
        default: Date.now,
    }
});

const Good = mongoose.model('Good', goodSchema);

module.exports = Good;